package com.puboot.module.admin.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.puboot.common.util.CoreConst;
import com.puboot.common.util.Pagination;
import com.puboot.module.admin.mapper.BizAboutAsMapper;
import com.puboot.module.admin.model.BizAboutUs;
import com.puboot.module.admin.model.BizContact;
import com.puboot.module.admin.service.BizAboutUsService;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * @author chen
 * @version V1.0
 * @date 2021年10月23日
 */
@Service
@AllArgsConstructor
public class BizAboutAsServiceImpl extends ServiceImpl<BizAboutAsMapper, BizAboutUs> implements BizAboutUsService {

    private BizAboutAsMapper bizAboutAsMapper;

    @Override
    public BizAboutUs findByStatus(Integer status) {
        return bizAboutAsMapper.findByStatus(status);
    }

    @Override
    public BizAboutUs getAboutUs() {
        QueryWrapper<BizAboutUs> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("status", CoreConst.STATUS_VALID);
        queryWrapper.last("limit 1");
        return baseMapper.selectOne(queryWrapper);
    }
}
